import store from "@/store";
export const typeListAll = () => {
  return [
    { value: 0, label: "未发布" },
    { value: 1, label: "已发布" }
  ];
};
export const VerifyTypeList = () => {
  return [
    { value: "", label: "全部" },
    { value: 0, label: "未审核" },
    { value: 1, label: "已审核" }
  ];
};

export const contentType = () => {
  return [
    { value: 0, label: "文本" },
    { value: 1, label: "图片" }
  ];
};
import { getTypeListByWiki } from "@/formRules/common/autoComplete";
export const searchRule = isAdmin => {
  return [
    {
      type: "select",
      field: "isVerify",
      title: "审核状态",
      value: "",
      col: {
        span: 6
      },
      options: VerifyTypeList(),
      tableVisible: true
    },

    {
      title: "名称",
      type: "input",
      value: "",
      field: "keyWord",
      col: {
        span: 6
      }
    }
  ];
};

export const editRule = lanmu => {
  return [
    {
      type: "hidden",
      hidden: true,
      field: "id",
      title: "ID",
      value: "",
      tableVisible: false
    },
    {
      type: "input",
      field: "keyWord",
      title: "名称",
      value: "",
      tableVisible: true
    },
    {
      type: "input",
      field: "categoryName",
      title: "栏目",
      value: "",
      tableVisible: lanmu ? true : false,
      hidden: true
    },
    {
      type: "select",
      field: "categoryId",
      title: "栏目",
      value: "",
      tableVisible: false,
      options: [],
      hidden: lanmu ? false : true
    },
    // getTypeListByWiki("categoryId", "栏目", {
    //   type: "cascader",
    //   value: [],
    //   tableVisible: false
    // }),
    {
      type: "hidden",
      hidden: true,
      field: "fieldList",
      title: "fieldList",
      value: [],
      tableVisible: false
    },

    {
      type: "hidden",
      field: "content",
      title: "知识节点",
      value: "",
      tableVisible: false
    },

    {
      type: "hidden",
      field: "introduction",
      title: "简介",
      value: "",
      tableVisible: false
    },

    // {
    //   type: "select",
    //   field: "isPublish",
    //   title: "发布状态",
    //   value: "",
    //   options: typeListAll(),
    //   hidden: true,
    //   filter: v => {
    //     return typeListAll().find(i => i.value == v)?.label;
    //   },
    //   tableVisible: true
    // },
    {
      type: "input",
      field: "isVerify",
      title: "审核状态",
      value: "",
      //   options: VerifyTypeList(),
      hidden: true,
      //   filter: v => {
      //     return VerifyTypeList().find(i => i.value == v)?.label;
      //   },
      tableVisible: true
    },
    {
      type: "datePicker",
      field: "createTime",
      title: "发布时间",
      value: "",
      tableVisible: true,
      hidden: true
    },
    {
      type: "FormWangEditor",
      field: "allContent",
      title: "内容",
      value: "",
      tableVisible: false
    }
  ];
};
